<template>
    <layout title="我的库存">
        <van-sticky :offset-top="48">
            <round-Tab  :roundTabList="roundTabList" :active="active" @clickTabs="clickTabs" />
        </van-sticky>
        <van-list v-model:loading="loading" :finished="finished" :finished-text="finishedText" @load="loadMore">
            <inventory-box v-for="(item) in list" :key="item.id" :item="item" />
        </van-list>
    </layout>
</template>

<script setup>
import layout from '@/components/Layout/index.vue'
import RoundTab from '@/components/RoundTab/index.vue'
import InventoryBox from './components/InventoryBox.vue'

import { ref, reactive } from 'vue'
import { useRoute, useRouter } from 'vue-router'

let active = ref('active1')
let roundTabList = reactive([
    {
        label: '待委托',
        value: 'active1'
    },
    {
        label: '已上架',
        value: 'active2'
    },
])

let clickTabs = (val) => {
    active.value = val.value
  
}
let loading = ref(false);
let finished = ref(false);
let finishedText = ref('--END--');

let list = ref([
    {
        "id": "99999999999999",
        "name": "香港养生堂燕窝胶原蛋白肽",
        "goods_images": [
            "https://ypsc1314.oss-cn-hangzhou.aliyuncs.com/601/uploads/20240408/4711b644cef94f09e9de64089a4736fa.jpg",
            "https://ypsc1314.oss-cn-hangzhou.aliyuncs.com/601/uploads/20240408/06b4c8131a71de27bd823c0148470826.jpg",
            "https://ypsc1314.oss-cn-hangzhou.aliyuncs.com/601/uploads/20240408/3a09460ca176986f24314607af1de641.jpg",
            "https://ypsc1314.oss-cn-hangzhou.aliyuncs.com/601/uploads/20240408/3f1c233669cc08823fa0259f3129f962.jpg"
        ],
        "old_price": "0.00",
        "price": "8770.00",
        "hold_user_id": 145864,
        "shop_user_id": null,
        "pick_up_status": 127,
        "status": 1,
        "is_buy": 0,
        "is_new": 0,
        "is_cut_to": 0,
        "cut_to": 0,
        "buy_num": 0,
        "content": "<p>商品简介:</p><p>商城重要提示:您成功购买此商品订单时已成为商城的代理/经销商并视为您认同所有规则。市场零售价465元/盒(50mLx6瓶)，特卖区定价465元/盒(50mLx6瓶)。超时交付规则:商品在“我的库存“上架3次或保留10日的仅能发货。提货发货时，参照提货规则，数量不足1盒的按照+1补足。</p><p>法国进口原料鲣鱼弹性蛋白肽帮助抵御肌肤衰老，能够显著促进人体合成胶原蛋白，使肌肤年轻丰盈;改善肌肤的弹性和柔软度,减少肌肤皱纹,改善皮肤纹理。</p><p>专利成分y-氨基丁酸(简称GABA)对机体的多种功能具有调节作用。净含量:50ml/瓶6瓶&nbsp; 保质期:18个月</p><p>建议食用量及食用方法:开瓶即饮，日食用量不超过3瓶</p><p>贮藏方法:贮存于阴凉干燥处</p><p><br></p><p>宝贝详情</p><p><img src=\"https://ypsc1314.oss-cn-hangzhou.aliyuncs.com/601/uploads/20240408/cda07b79cc2c2cfbf6c2aba58c56cef2.jpg\" data-filename=\"filename\" style=\"width: 481.725px;\"><img src=\"https://ypsc1314.oss-cn-hangzhou.aliyuncs.com/601/uploads/20240408/37e8f4a4cd8c3c9dd831edf288bc91af.jpg\" data-filename=\"filename\" style=\"width: 481.725px;\"><img src=\"https://ypsc1314.oss-cn-hangzhou.aliyuncs.com/601/uploads/20240408/648662a8623e3bf1377d8ddaa9abaac1.jpg\" data-filename=\"filename\" style=\"width: 481.725px;\"><img src=\"https://ypsc1314.oss-cn-hangzhou.aliyuncs.com/601/uploads/20240408/a83a38593986eda4259bdb2da3c69fa6.jpg\" data-filename=\"filename\" style=\"width: 481.725px;\"><br></p>",
        "images": [],
        "createtime": "2024-04-18 18:58:01",
        "updatetime": "2024-08-06 09:55:17",
        "orderspecial_id": null,
        "is_edit": 0,
        "shelf_time": null,
        "shop_user": null,
        "hold_user": {
            "id": 145864,
            "nickname": "测试1",
            "email": "",
            "mobile": "15021794401",
            "avatar": "",
            "shop_manager": 1,
            "shop_no": "123456",
            "shop_name": "ceshi",
            "real_name": null,
            "wx_payment_image": null,
            "alipay_payment_image": null,
            "account_bank_name": null,
            "bank_account": null,
            "invitation_code": "V0H53Z",
            "url": "/u/145864",
            "today_money": "0.00",
            "total_money": "32.55",
            "today_order_num": 0
        },
        "buy_user": null,
        "to_shop_user": null
    }])
let loadMore = () => {
    console.log(list.value, '数据')
    setTimeout(() => {

        loading.value = false;   // 数据全部加载完成

        if (list.value.length >= 1) {   // 数据全部加载完成
            finished.value = true;
        }
    }, 1000);
}




</script>

<style lang="scss" scoped>
</style>